/**
 * @param {string} jewels
 * @param {string} stones
 * @return {number}
*/
var numJewelsInStones = function(jewels, stones) {
  let set = new Set(), result = 0;
  for(let i = 0; i < jewels.length; i++) {
    set.add(jewels[i]);
  }
  for(let j = 0; j < stones.length; j++) {
    if(set.has(stones[j])) result++;
  }
  return result;
};
let jewels = "aA", stones = "aAAbbbb";
console.log(numJewelsInStones(jewels, stones));
jewels = "z", stones = "ZZ";
console.log(numJewelsInStones(jewels, stones));
